<script type="text/javascript">
$(function() {
	var user = {
		getQueryCondition: function(data) {
			var param = {};
//				param.specificcations = $.trim($("#specificcations").val());
//				param.materialName = $.trim($("#materialName").val());
			param.costId = GetQueryString("costId");
			param.pageNumber = Number(data.start/data.length)+1  || 1;
			param.pageSize = data.length   || 15;
			param.state=$("#state").val();
			param.draw = 1;
			return param;
		}
	};
    var dataTable = $("#firm-post-list").zosoftDataTable({
    	searchButton:"#searchButton",
		ajax: function(data, callback) { //ajax配置为function,手动调用异步查询
			$.post("/guidance_service/front/data/individual/search.do", user.getQueryCondition(data),function(result) {
					//封装返回数据，这里仅演示了修改属性名
					var returnData = {};
					returnData.recordsTotal = result.data.totalRow;
					returnData.recordsFiltered = result.data.totalRow; //后台不实现过滤功能，每次查询均视作全部结果
					returnData.data = result.data.list;
					callback(returnData);
			});
		},
		//使用对象数组，一定要配置columns，告诉 DataTables 每列对应的属性
		//data 这里是固定不变的，id，name，age，sex等为你数据里对应的属性
		columns: [
			{
				data: "individualName",
				render: function(data) {
					return data || "";
				}
			},
			{
				data: "individualBudget",
				render: function(data, type, row) {
					if(data){
						return '<a class="label label-success  radius" style="text-decoration:none" onclick="base_open(\'individualBudget\','+row.costId+','+row.individualId+')" href="javascript:;" title="详情">详情</a>';
					}else{
						return '<a class="label label-primary  radius" style="text-decoration:none" onclick="base_add(\'individualBudget\','+row.costId+','+row.individualId+')" href="javascript:;" title="添加">添加</a>';
					}
				}
			},
			{
				data: "unitBudget",
				render: function(data, type, row){
					if(data){
						return '<a class="label label-success  radius" style="text-decoration:none" onclick="base_open(\'unitBudget\','+row.costId+','+row.individualId+')" href="javascript:;" title="详情">详情</a>';
					}else{
						return '<a class="label label-primary  radius" style="text-decoration:none" onclick="base_add(\'unitBudget\','+row.costId+','+row.individualId+')" href="javascript:;" title="添加">添加</a>';
					}
				}
			},
			{
				data: "otherSummary",
				render: function(data, type, row) {
					if(data){
						return '<a class="label label-success  radius" style="text-decoration:none" onclick="base_open(\'otherSummary\','+row.costId+','+row.individualId+')" href="javascript:;" title="详情">详情</a>';
					}else{
						return '<a class="label label-primary  radius" style="text-decoration:none" onclick="base_add(\'otherSummary\','+row.costId+','+row.individualId+')"href="javascript:;" title="添加">添加</a>';
					}
				}
			},
			{
				data: "billtaxList",
				render: function(data, type, row){
					if(data){
						return '<a class="label label-success  radius" style="text-decoration:none" onclick="base_open(\'billtaxList\','+row.costId+','+row.individualId+')" href="javascript:;" title="详情">详情</a>';
					}else{
						return '<a class="label label-primary  radius" style="text-decoration:none" onclick="base_add(\'billtaxList\','+row.costId+','+row.individualId+')"href="javascript:;" title="添加">添加</a>';
					}
				}
			},
			{
				data: "unitmaterialSummary", //
				render: function(data, type, row) {
					if(data){
						return '<a class="label label-success  radius" style="text-decoration:none"  onclick="base_open(\'unitmaterialSummary\','+row.costId+','+row.individualId+')" href="javascript:;" title="详情">详情</a>';
					}else{
						return '<a class="label label-primary  radius" style="text-decoration:none"  onclick="base_add(\'unitmaterialSummary\','+row.costId+','+row.individualId+')"href="javascript:;" title="添加">添加</a>';
					}
				}
			},
			{
				data: "totalMeasures", //
				render: function(data, type, row){
					if(data){
						return '<a class="label label-success  radius" style="text-decoration:none" onclick="base_open(\'totalMeasures\','+row.costId+','+row.individualId+')"  href="javascript:;" title="详情">详情</a>';
					}else{
						return '<a class="label label-primary  radius" style="text-decoration:none" onclick="base_add(\'totalMeasures\','+row.costId+','+row.individualId+')"  href="javascript:;" title="添加">添加</a>';
					}
				}
			},
			{
				data: "individualId",
				render: function(data, type, row) {
					if(data){
						return '<a class="label label-success  radius" style="text-decoration:none" onclick="base_open(\'dataInfo\','+row.costId+','+row.individualId+')"  href="javascript:;" title="详情">详情</a>';
					}else{
						return '<a class="label label-primary  radius" style="text-decoration:none" onclick="base_add(\'dataInfo\','+row.costId+','+row.individualId+')"  href="javascript:;" title="添加">添加</a>';
					}
				}
			},
			{
				data: "individualId",
				render: function(data, type, row) {
					if(GetQueryString("ismanage")=="1"){
						return '<a  class="label label-danger  radius" style="text-decoration:none" onClick="guidanceinfo_shenhe('+row.individualId+',' + data + ',this)" href="javascript:;" title="审核">审核</a>';
					}else{
						return	'<a style="text-decoration:none" class="ml-5" onClick=\'update("'+row.individualId+'","'+row.individualName+'","'+row.individualCode+'")\' href="javascript:;" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a>' +
						'<a style="text-decoration:none" class="ml-5" onClick="del('+data+',this)" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>';
					}
				}
			}
		]
	});
});
</script>